import uvm_pkg::*;
`include "uvm_macros.svh"

class mpi_agent extends uvm_agent;
	mpi_xaction   mpi_proto;
	mpi_driver    drv;
	mpi_sequencer seqr;
	mpi_adapter   adapter;
	
	`uvm_component_utils(mpi_agent)
	
	function new(string name,uvm_component parent);
		super.new(name,parent);
		`uvm_info(get_type_name(), "mpi agent start", UVM_LOW);
	endfunction: new
	
	virtual function void build_phase(uvm_phase phase);
		super.build_phase(phase);
		`uvm_info(get_type_name(),"mpi_agent(): build_phase start",UVM_LOW);
		
		this.seqr = mpi_sequencer::type_id::create("seqr",this);
		this.drv  = mpi_driver::type_id::create("drv",this);
		this.mpi_proto = mpi_xaction::type_id::create("mpi_proto",this);
		this.adapter = mpi_adapter::type_id::create("adapter",this);
		this.adapter.proto = this.mpi_proto;
		`uvm_info(get_type_name(), "build_phase(): Use stb_reg_adapter to adapter uvm_reg_item to stb_rw_sequence_item", UVM_HIGH);
	endfunction: build_phase
	
	virtual function void connect_phase(uvm_phase phase);
		super.connect_phase(phase);
		`uvm_info(get_type_name(),"mpi_agent(): build_phase start",UVM_LOW);
		
		this.drv.seq_item_port.connect(this.seqr.seq_item_export);
	endfunction: connect_phase
endclass: mpi_agent
